import { createBrowserRouter } from "react-router-dom";
import Layout from "@/pages/Layout";
import Login from "@/pages/Login";
import AutToken from '@/components/AutToken' //登录权限组件
/* import Home from "@/pages/Home";
import Atircal from "@/pages/Atircal";
import Publicke from "@/pages/Publicke"; */

// 路由懒加载
import { Suspense, lazy } from "react";
const Home = lazy(() => import('@/pages/Home'));
const Atircal = lazy(() => import('@/pages/Atircal'));
const Publicke = lazy(() => import('@/pages/Publicke'));
const Manage = lazy(() => import('@/pages/Manage'))


const router = createBrowserRouter([
    {
        path: '/',
        element: <AutToken> <Layout></Layout> </AutToken>,
        children: [
            {
                // path:'home',
                index: true,
                element:<Suspense fallback={'加载中'}><Home></Home></Suspense> 
            },
            {
                path:'atircal',
                element: <Suspense fallback={'加载中'}><Atircal></Atircal></Suspense> 
            },
            {
                path:'publicke',
                element: <Suspense fallback={'加载中'}><Publicke></Publicke></Suspense> 
            },
            {
                path:'manage',
                element: <Suspense fallback={'加载中'}><Manage></Manage></Suspense> 
            }
        ]
    },
    {
        path: '/login',
        element: <Login></Login>
    }
])

export default router